﻿<!--
	RegExpress
	
	Copyright (c) 2010, Daniel McGaughran
	
	Licensed under the Apache Licence, Version 2.0 (the "Licence");
	you may not use this file except in compliance with the Licence.
	You may obtain a copy of the License at
	
		http://www.apache.org/licenses/LICENSE-2.0
	
	Unless required by applicable law or agreed to in writing, software
	distributed under the Licence is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the Licence for the specific language governing permissions and
	limitations under the Licence.
	
	-->

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:xrCt="clr-namespace:XrControls;assembly=XrControls" >

	<Style x:Key="DefaultWindowStyle" TargetType="{x:Type Window}">
		<Setter Property="Background" Value="{DynamicResource WindowBgndBrush}" />
		<Setter Property="WindowStyle" Value="None" />
		<Setter Property="WindowState" Value="Maximized" />
		<Setter Property="AllowsTransparency" Value="True" />
	</Style>


	<Style x:Key="HostControlStyle" TargetType="{x:Type UserControl}">
		<Setter Property="Margin" Value="8,8,8,8" />
	</Style>


	<Style TargetType="{x:Type GridSplitter}">
		<Setter Property="Width" Value="4" />
		<Setter Property="SnapsToDevicePixels" Value="True" />
		<Setter Property="ShowsPreview" Value="False" />
		<Setter Property="Margin" Value="2,4" />
		<Setter Property="HorizontalAlignment" Value="Center" />
		<Setter Property="VerticalAlignment" Value="Stretch" />
		<Setter Property="Background" Value="{DynamicResource OrnamentFgndBrush}" />
	</Style>

	<Style x:Key="SmallIcon" TargetType="{x:Type Image}">
		<Setter Property="Width" Value="32" />
		<Setter Property="Height" Value="32" />
		<Setter Property="Margin" Value="2,2,6,2" />
		<Setter Property="DockPanel.Dock" Value="Left" />
		<Setter Property="FlowDirection" Value="LeftToRight" />
	</Style>
	
	
	<Style x:Key="HiddenPath" TargetType="{x:Type Path}">
		<Setter Property="Stroke" Value="{StaticResource OrnamentFgndBrush}" />
		<Setter Property="StrokeThickness" Value="4" />
		<Setter Property="Stretch" Value="Uniform" />
		<Setter Property="Height" Value="24" />
		
		<Setter Property="StrokeStartLineCap" Value="Round" />
		<Setter Property="StrokeEndLineCap" Value="Round" />
		<Setter Property="StrokeLineJoin" Value="Round" />
	</Style>

	<Style x:Key="VisiPath" TargetType="{x:Type Path}">
		<Setter Property="StrokeThickness" Value="4" />
		<Setter Property="Stretch" Value="Uniform" />
		<Setter Property="Width" Value="20" />
		<Setter Property="Height" Value="24" />

		<Setter Property="StrokeStartLineCap" Value="Round" />
		<Setter Property="StrokeEndLineCap" Value="Round" />
		<Setter Property="StrokeLineJoin" Value="Round" />
	</Style>


	<!-- TextBoxes -->
	<ControlTemplate x:Key="DefaultTextBoxTemplate" TargetType="{x:Type TextBoxBase}">
		<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
				CornerRadius="2" BorderThickness="1" Padding="2" SnapsToDevicePixels="True"
				HorizontalAlignment="Stretch" VerticalAlignment="Center">
			<ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
		</Border>
	</ControlTemplate>
	
	<ControlTemplate x:Key="EditorTextBoxTemplate" TargetType="{x:Type TextBoxBase}">
		<Border Background="{TemplateBinding Background}"
				CornerRadius="2" Padding="4"
				HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
				VerticalAlignment="{TemplateBinding VerticalAlignment}">
			<ScrollViewer Margin="0" x:Name="PART_ContentHost" Focusable="false" VerticalScrollBarVisibility="Auto"/>
		</Border>
	</ControlTemplate>


	<Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBoxBase}">
		<Setter Property="Foreground" Value="{StaticResource EditorTextBoxFgndBrush}" />
		<Setter Property="BorderBrush" Value="{StaticResource TextBoxFrameBrush}" />
		<Setter Property="Background" Value="{StaticResource EditorTextBoxBgndBrush}" />
		<Setter Property="FontFamily" Value="Consolas, Courier New" />
		<Setter Property="FontSize" Value="20" />

		<Setter Property="Template" Value="{StaticResource DefaultTextBoxTemplate}" />
		<Setter Property="Margin" Value="4,2" />
		<Setter Property="MinWidth" Value="64" />

		<Style.Triggers>
			<Trigger Property="IsEnabled" Value="False">
				<Setter Property="Foreground" Value="{StaticResource DisabledFgndBrush}" />
				<Setter Property="BorderBrush" Value="{StaticResource DisabledFrameBrush}" />
				<Setter Property="Background" Value="{StaticResource DisabledBgndBrush}" />
			</Trigger>
		</Style.Triggers>
	</Style>


	<Style x:Key="EditorTextBox" TargetType="{x:Type TextBox}">
		<Setter Property="Foreground" Value="{StaticResource EditorTextBoxFgndBrush}" />
		<Setter Property="Background" Value="{StaticResource EditorTextBoxBgndBrush}" />
		<Setter Property="FontFamily" Value="Consolas, Courier New" />
		<Setter Property="Margin" Value="4,2" />
		<Setter Property="FontSize" Value="20" />
		<Setter Property="AcceptsReturn" Value="True" />
		<Setter Property="AcceptsTab" Value="True" />
		<Setter Property="MinLines" Value="3" />
		<Setter Property="TextWrapping" Value="Wrap" />
		<Setter Property="FlowDirection" Value="LeftToRight" />

		<Setter Property="Template" Value="{StaticResource EditorTextBoxTemplate}" />

		<Style.Triggers>
			<Trigger Property="IsEnabled" Value="False">
				<Setter Property="Foreground" Value="{StaticResource DisabledFgndBrush}" />
				<Setter Property="Background" Value="{StaticResource DisabledBgndBrush}" />
			</Trigger>
			<Trigger Property="IsReadOnly" Value="True">
				<Setter Property="Foreground" Value="{StaticResource ReadOnlyTextBoxFgndBrush}" />
				<Setter Property="Background" Value="{StaticResource ReadOnlyTextBoxBgndBrush}" />
			</Trigger>
		</Style.Triggers>
	</Style>

    
    <!-- Toggle switches -->
    <Style TargetType="{x:Type xrCt:ToggleSwitch}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type xrCt:ToggleSwitch}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" MinWidth="16" />
                                <ColumnDefinition Width="Auto" MinWidth="16" />
                            </Grid.ColumnDefinitions>

                            <ContentPresenter />

                            <Button x:Name="P_ClearButton" Grid.Column="1" Style="{StaticResource NegButton}">
                                <Path x:Name="clearSymbol" Style="{StaticResource VisiPath}"
									Data="M 1,1 L 7,7 M 7,1 L 1,7"
									Stroke="{StaticResource NegButtonFgndBrush}" />
                            </Button>
                            <Button x:Name="P_SetButton" Grid.Column="2" Style="{StaticResource AffButton}">
                                <Path x:Name="setSymbol" Style="{StaticResource VisiPath}"
									Data="M 1,4 L 3,7 L 7,1"
									Stroke="{StaticResource AffButtonFgndBrush}" />
                            </Button>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
						<Trigger Property="IsEnabled" Value="False">
							<Setter TargetName="P_SetButton" Property="Background"
                                    Value="{StaticResource AffButtonBgndBrush}" />
							<Setter TargetName="P_SetButton" Property="BorderBrush"
                                    Value="{StaticResource AffButtonFrameBrush}" />
							<Setter TargetName="setSymbol" Property="Stroke"
                                    Value="{StaticResource AffButtonFgndBrush}" />
							<Setter TargetName="P_ClearButton" Property="Background"
                                    Value="{StaticResource NegButtonBgndBrush}" />
							<Setter TargetName="P_ClearButton" Property="BorderBrush"
                                    Value="{StaticResource NegButtonFrameBrush}" />
							<Setter TargetName="clearSymbol" Property="Stroke"
                                    Value="{StaticResource NegButtonFgndBrush}" />
						</Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Value" Value="True" />
                                <Condition Property="IsEnabled" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="P_SetButton" Property="Background"
                                    Value="{StaticResource AffButtonSelBgndBrush}" />
							<Setter TargetName="P_SetButton" Property="BorderBrush"
                                    Value="{StaticResource AffButtonSelFrameBrush}" />
							<Setter TargetName="setSymbol" Property="Stroke"
                                    Value="{StaticResource AffButtonSelFgndBrush}" />
						</MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Value" Value="False" />
                                <Condition Property="IsEnabled" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="P_ClearButton" Property="Background"
                                    Value="{StaticResource NegButtonSelBgndBrush}" />
							<Setter TargetName="P_ClearButton" Property="BorderBrush"
                                    Value="{StaticResource NegButtonSelFrameBrush}" />
							<Setter TargetName="clearSymbol" Property="Stroke"
                                    Value="{StaticResource NegButtonSelFgndBrush}" />
						</MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


	<Style x:Key="PopupExpander" TargetType="{x:Type Expander}">
		<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
		<Setter Property="VerticalContentAlignment" Value="Stretch"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Expander}">
					<Grid>
						<ToggleButton x:Name="HeaderSite"
								Margin="1" Padding="{TemplateBinding Padding}" 
								Content="{TemplateBinding Header}"
								ContentTemplate="{TemplateBinding HeaderTemplate}"
								ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
								FontFamily="{TemplateBinding FontFamily}"
								FontSize="18"
								Foreground="{TemplateBinding Foreground}"
								HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
								VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
								IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" 
								/>
						<Popup x:Name="ExpandSite" IsOpen="False" AllowsTransparency="True">
							<Border Padding="8" Margin="16" CornerRadius="16"
									Background="{StaticResource PopupBgndBrush}"
									BorderBrush="{StaticResource PopupFrameBrush}" BorderThickness="4">
								<Border.BitmapEffect>
									<OuterGlowBitmapEffect GlowColor="Black" GlowSize="16" Opacity="0.8" /> 
								</Border.BitmapEffect>
								<ContentPresenter Margin="{TemplateBinding Padding}"
									HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
									VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
									Focusable="false"/>
							</Border>
						</Popup>							
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsExpanded" Value="true">
							<Setter TargetName="ExpandSite" Property="IsOpen" Value="True"/>
						</Trigger>
						<Trigger Property="IsEnabled" Value="false">
							<Setter Property="Foreground" Value="{StaticResource OrnamentFgndBrush}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>


</ResourceDictionary>